﻿using System;
/// <summary>
/// AbsESF_MetaObject【IESF_Recycle接口】
/// </summary>
public partial class AbsESF_MetaObject : IESF_Recycle, IESF_RecycleEventHandler
{
    public event Action<IESF_Recycle> OnAfterRecycleHandler;
    public event Action<IESF_Recycle> OnBeforeRecycleHandler;
    #region IESF_IRecycle    
    /// <summary>
    /// 回收
    /// </summary>
    public void Recycle()
    {
        OnBeforeRecycleHandler?.Invoke(this);
        OnBeforeRecycleHandler = null;
        OnRecycle();
        OnAfterRecycleHandler?.Invoke(this);
        OnAfterRecycleHandler = null;
    }
    
    /// <summary>
    /// 回收
    /// </summary>
    protected virtual void OnRecycle() { }
   
    #endregion
}